<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Amaze UI Admin index Examples</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <script src="/Public/assets/js/echarts.min.js"></script>
    <link rel="stylesheet" href="/Public/assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="/Public/assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="/Public/assets/css/app.css">
    <script src="/Public/assets/js/jquery.min.js"></script>
   
</head>

<body data-type="widgets">
    <script src="/Public/assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 头部 -->
        <include file="Public/tpl/admintop.html"/>
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <!-- 侧边导航栏 -->
         <include file="Public/tpl/adminLeft.html"/>
        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">

            <div class="container-fluid am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 产品 <small>栏目</small></div>
                        <p class="page-header-description"></p>
                    </div>
                    <div class="am-u-lg-3 tpl-index-settings-button">
                        <button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>
                    </div>
                </div>

            </div>

            <div class="row-content am-cf">

                <input type="radio" name="class" alt="1" style="margin-left:20px" onclick="class1(this)" ><span style="color:white;font-size:16px" >一级</span>
                <input type="radio" name="class" alt="2" style="margin-left:20px" onclick="class1(this)" ><span style="color:white;font-size:16px" >二级</span>
                <input type="radio" name="class" style="margin-left:20px" alt="3" onclick="class1(this)" ><span style="color:white;font-size:16px" >三级</span>
                <div style="margin-top:50px" id="push">

                   
                </div>  
                   <input type="text" style="margin-top:30px;width:280px;height:40px" id="addclass"><br/>
                   <button onclick="add()">提交</button>
            </div>

            </div>



    <script type="text/html" id="pushClass1">


            <select name="" id="ji" style="margin-left:20px" alt="1" onchange="showClass(this)">
                <option value="" selected="selected">一级目录</option>
                <%for(var i=0 ;i< data.length; i++){%>
                    <option value="<%=data[i].id%>"><%=data[i].name%></option>
                <%}%>

          
    </script>

    <script type="text/html" id="pushClass2">


            <select name="" id="ji" style="margin-left:20px" alt="2" onchange="showClass(this)">
                <option value="" selected="selected">一级目录</option>
                <%for(var i=0 ;i< data.length; i++){%>
                    <option value="<%=data[i].id%>"><%=data[i].name%></option>
                <%}%>
            </select>
            <select name="" id="showColumn" style="margin-left:20px" alt="3">
                <option value="" selected="selected">二级目录</option>
                
            </select> 

    </script>
    <script type="text/html" id="pushClass3">


            <select name="" id="ji" style="margin-left:20px" alt="3" onchange="showClass(this)">
               <option value="" selected="selected" ">一级目录</option>
                <%for(var i=0 ;i< data.length; i++){%>
                    <option value="<%=data[i].id%>"><%=data[i].name%></option>
                <%}%>
            </select>
             <select name="" id="showColumn" style="margin-left:20px" alt="3" onchange="showClass1(this)">
                <option value="" selected="selected">二级目录</option>
               
            </select>
             <select name="" id="showColumn1" style="margin-left:20px" alt="3">
                <option value="" selected="selected">三级目录</option>
               
            </select>

    </script>

    <script type="text/html" id="showCol">

            <option value="" selected="selected">二级目录</option>
            <%for(var i=0 ;i < data.length; i++){%>
                <option value="<%=data[i].id%>"><%=data[i].name%></option>
            <%}%>
            
    </script>
     <script type="text/html" id="showCol2">

            <option value="" selected="selected">三级目录</option>
            <%for(var i=0 ;i < data.length; i++){%>
                <option value="<%=data[i].id%>"><%=data[i].name%></option>
            <%}%>
            
    </script>



    <script src="/Public/js/template-native.js"></script>
    <script src="/Public/js/showclass.js"></script>
    <script src="/Public/assets/js/amazeui.min.js"></script>
    <script src="/Public/assets/js/amazeui.datatables.min.js"></script>
    <script src="/Public/assets/js/dataTables.responsive.min.js"></script>
    <script src="/Public/assets/js/app.js"></script>
    
    <script type="text/javascript" >
        


        function class1(obj){
            var fenji=$(obj).attr('alt');
            if (fenji=='1') {              
                $('#push').html("");               
                $.get('/Api/Index/classSelect',{'fid':'0'},function(ret){
                     var html=template('pushClass1',ret);
                     $('#push').append(html);
                })
                
            }else if(fenji=='2'){               
                $('#push').html("");
                $.get('/Api/Index/classSelect',{'fid':'0'},function(ret){
                     var html=template('pushClass2',ret);
                     $('#push').append(html);
                })
                
            }else if(fenji=='3'){           
                $('#push').html("");
                $.get('/Api/Index/classSelect',{'fid':'0'},function(ret){
                     var html=template('pushClass3',ret);
                     $('#push').append(html);
                })
               
            }
           

        }
     
       
        function add(){
            var  calssval=$('#ji').attr('alt'); 
            if (calssval=='1') {

                var fid='0';
                var name=$('#addclass').val();
                $('#addclass').val('');
                $.post('/Api/Index/class1',{'name':name,'fid':fid},function(ret){
                         show.class1();

                })
            }else if(calssval=='2') {
                var fid=$('#ji').val();
                var name=$('#addclass').val();
                $('#addclass').val('');
                $.post('/Api/Index/class1',{'name':name,'fid':fid},function(ret){
                         show.class2();
                })
            }else if(calssval=='3') {
                var fid=$('#showColumn').val();
                var name=$('#addclass').val();
                $('#addclass').val('');
                $.post('/Api/Index/class1',{'name':name,'fid':fid},function(ret){
                         show.class3();
                })
            } 
           
           
        }
        function showClass(obj){ 
            //var fenji=$(obj).attr('alt');     
            var fid=$(obj).val();
            $('#showColumn').html("");
            $.get('/Api/Index/classSelect',{'fid':fid},function(ret){
                        if (ret.status==true){                                                                           
                                var html=template('showCol',ret);
                                $('#showColumn').append(html);                                      
                         }else {
                                var html='<option value="">二级目录</option>';
                                $('#showColumn').append(html);
                         }
                     
            })
        }
        function showClass1(obj){ 
           
            var fid=$(obj).val();
            $('#showColumn1').html("");
            $.get('/Api/Index/classSelect',{'fid':fid},function(ret){
                        if (ret.status==true){                                                      
                                var html=template('showCol2',ret);
                                $('#showColumn1').append(html);
                                         
                         }else {
                                var html='<option value="">三级目录</option>';
                                $('#showColumn1').append(html);
                         }
                     
            })
        }


    </script>
</body>

</html>